package org.andy.eureka.client.config;


import javax.annotation.Resource;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;

@Configuration
public class TransactionConfig /*implements TransactionManagementConfigurer */{

	
	/*@Resource(name="transactionManager1")
	private PlatformTransactionManager txManager1;
	
	

	@Resource(name="transactionManager2")
	private PlatformTransactionManager txManager2;
	
	
	@Bean
	public Object testBean(PlatformTransactionManager[] platformTransactionManager){
	System.out.println(">>>>>>>>>>>>>>>>>>>"+platformTransactionManager[0].getClass().getName());
	System.out.println(">>>>>>>>>>>>>>>>>>>"+platformTransactionManager[1].getClass().getName());
	return null;
	}
	
	
	@Bean(name="transactionManager1")
	public PlatformTransactionManager txManager(DataSource dataSource){
		return new DataSourceTransactionManager(dataSource);
	}
	
	@Bean(name="transactionManager2")
	public PlatformTransactionManager txManager2(EntityManagerFactory factory){
		return new JpaTransactionManager(factory);
	}

	@Override
	public PlatformTransactionManager annotationDrivenTransactionManager() {
		// TODO Auto-generated method stub
		return txManager2;
	}*/


	
	
	
}
